﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Critr
{
    public partial class ctlToggleableTextbox : UserControl
    {
        public string Column { get; set; }
        public override string Text
        {
            get
            {
                return textbox.Text;
            }
        }

        public bool Checked
        {
            get
            {
                return checkbox.Checked;
            }
        }

        public ctlToggleableTextbox()
        {
            InitializeComponent();
        }

        protected void checkbox_CheckedChanged(object sender, EventArgs e)
        {
            textbox.Enabled = checkbox.Checked;

            if (textbox.Enabled == true)
            {
                textbox.Focus();
                textbox.SelectionStart = 0;
                textbox.SelectionLength = textbox.Text.Length;
            }
        }
    }
}
